package com.example.demo.service.impl;

import com.example.demo.bean.UmsMember;
import com.example.demo.mapper.UmsMemberMapper;
import com.example.demo.service.UmsMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class UmsMemberServiceImpl implements UmsMemberService {
    @Autowired
    UmsMemberMapper umsMemberMapper;
    @Override
    public UmsMember addone(UmsMember umsMember) {
        int i=umsMemberMapper.insert(umsMember);
        if(i==0) return null;
        else return umsMember;
    }

    @Override
    public UmsMember update(UmsMember umsMember) {
        return null;
    }

    @Override
    public UmsMember get(UmsMember umsMember) {
//        Example umsExample = new Example(UmsMember.class);
//        System.out.println(umsMember.getId());
//        umsExample.createCriteria().andEqualTo("id",umsMember.getId());
//        return umsMemberMapper.selectOneByExample(umsExample);
        return umsMemberMapper.selectOne(umsMember);
    }
    @Override
    public int delete(UmsMember umsMember) {
        return 0;
    }
}
